package components.base
{
	import mx.controls.LinkButton;
	import mx.events.FlexEvent;
	
	import framework.LangMgr;
	
	import interfaces.IDispose;
	
	[Style(name="icon", type="Class", inherit="no")]
	public class BaseLinkButton extends LinkButton implements IDispose
	{
		/**
		 * 国际化标识
		 */
		private var _locale:String;
		public function get locale():String
		{
			return _locale;
		}
		public function set locale(p_str:String):void
		{
			_locale = p_str;
			resourcesChanged();
		}
		
		public function BaseLinkButton()
		{
			super();
			addEventListener(FlexEvent.CREATION_COMPLETE, creationCompleteHandler);
		}
		
		/**
		 * 控件创建完成后调用初始化信息
		 */
		private function creationCompleteHandler(p_evt:FlexEvent):void
		{
			removeEventListener(FlexEvent.CREATION_COMPLETE, creationCompleteHandler);
			if(styleName == null)
				styleName = "linkButton";
		}
		
		/**
		 * 实现国际化
		 */
		override protected function resourcesChanged():void
		{
			super.resourcesChanged();
			if(_locale)
				label = LangMgr.getResourceByLocaleKey(_locale);
		}
		
		public function dispose():void
		{
			
		}
	}
}